<div class="layui-tab layui-tab-card">
    <ul class="layui-tab-title">
      <li class="layui-this">出售订单</li>
      <li>购买订单</li>
      <li>抢购商品</li>
      <li>粉丝</li>
    </ul>
    <div class="layui-tab-content" style="height: 100px;">
      <div class="layui-tab-item layui-show">
        <table class="layui-table">
          <thead>
            <tr>
              <th>订单号</th>
              <th>下单时间</th>
              <th>商品价格</th>
              <th>商品信息</th>
              <th>买方信息</th>
              <th>卖方信息</th>
              <th>支付凭证</th>
              <th>状态</th>
            </tr> 
          </thead>
          <tbody>
            {foreach name="sale" item="val" key="key"}
            <tr>
              <td>{$val.order_no}</td>
              <td>{$val.create_time}</td>
              <td>{$val.g_price/100}</td>
              <td>{$val.goodsname}</td>
              <td>{$val.buyer}</td>
              <td>{$val.saler}</td>
              <!-- <td>查看{$val.img}</td> -->
              <td><a class="layui-btn layui-btn-xs layui-btn-normal view_img" data-id="{$val.id}">查看</a></td>
              <td>
                {eq name="val.state" value="-1"}已删除{/eq}
                {eq name="val.state" value="0"}未上架{/eq}
                {eq name="val.state" value="1"}已上架{/eq}
                {eq name="val.state" value="2"}待支付{/eq}
                {eq name="val.state" value="3"}已支付{/eq}
                {eq name="val.state" value="4"}已确认{/eq}
                {eq name="val.state" value="5"}待解决{/eq}
                {eq name="val.state" value="6"}已提货{/eq}
                {eq name="val.state" value="7"}已发货{/eq}
              </td>
            </tr>
            {/foreach}
          </tbody>
        </table>
      </div>

      <div class="layui-tab-item">
        <table class="layui-table">
          <thead>
            <tr>
              <th>订单号</th>
              <th>下单时间</th>
              <th>商品价格</th>
              <th>商品信息</th>
              <th>买方信息</th>
              <th>卖方信息</th>
              <th>支付凭证</th>
              <th>状态</th>
            </tr> 
          </thead>
          <tbody>
            {foreach name="buy" item="va" key="k"}
            <tr>
              <td>{$va.order_no}</td>
              <td>{$va.create_time}</td>
              <td>{$va.g_price/100}</td>
              <td>{$va.goodsname}</td>
              <td>{$va.buyer}</td>
              <td>{$va.saler}</td>
              <!-- <td>{$va.img}</td> -->
              <td><a class="layui-btn layui-btn-xs layui-btn-normal view_img" data-id="{$va.id}">查看</a></td>
              <td>
                {eq name="va.state" value="-1"}已删除{/eq}
                {eq name="va.state" value="0"}未上架{/eq}
                {eq name="va.state" value="1"}已上架{/eq}
                {eq name="va.state" value="2"}待支付{/eq}
                {eq name="va.state" value="3"}已支付{/eq}
                {eq name="va.state" value="4"}已确认{/eq}
                {eq name="va.state" value="5"}待解决{/eq}
                {eq name="va.state" value="6"}已提货{/eq}
                {eq name="va.state" value="7"}已发货{/eq}
              </td>
            </tr>
            {/foreach}
          </tbody>
        </table>
      </div>

      <div class="layui-tab-item">
        <table class="layui-table">
          <thead>
            <tr>
              <th>商品ID</th>
              <th>商品编号</th>
              <th>商品名称</th>
              <th>初始价格</th>
              <th>价格</th>
              <th>商品简介</th>
              <!-- <th>商品图</th> -->
              <th>状态</th>
            </tr> 
          </thead>
          <tbody>
            {foreach name="qiang" item="qia" key="q"}
            <tr>
              <td>{$qia.id}</td>
              <td>{$qia.code}</td>
              <td>{$qia.name}</td>
              <td>{$qia.base_price/100}</td>
              <td>{$qia.price/100}</td>
              <td>{$qia.summary}</td>
              <!-- <td><img src="{$qia.img}" style="width: 200px;height:200px;"></td> -->
              <td>
                {eq name="qia.state" value="-1"}已删除{/eq}
                {eq name="qia.state" value="0"}未上架{/eq}
                {eq name="qia.state" value="1"}已上架{/eq}
                {eq name="qia.state" value="2"}待支付{/eq}
                {eq name="qia.state" value="3"}已支付{/eq}
                {eq name="qia.state" value="4"}已确认{/eq}
                {eq name="qia.state" value="5"}待解决{/eq}
                {eq name="qia.state" value="6"}已提货{/eq}
                {eq name="qia.state" value="7"}已发货{/eq}
              </td>
            </tr>
            {/foreach}
          </tbody>
        </table>
      </div>

      <div class="layui-tab-item">
        <table class="layui-table">
          <thead>
            <tr>
              <th>手机号</th>
              <th>昵称</th>
              <th>邀请时间</th>
              <th>关系</th>
              <th>购买订单</th>
            </tr> 
          </thead>
          <tbody>
            {foreach name="fans" item="fan" key="f"}
            <tr>
              <td>{$fan.phone}</td>
              <td>{$fan.nickname}</td>
              <td>{$fan.create_time}</td>
              <td>{$fan.level}</td>
              <!-- <td>查看</td> -->
              <td><a class="layui-btn layui-btn-xs layui-btn-normal view_order" data-id="{$fan.id}">查看</a></td>
            </tr>
            {/foreach}
          </tbody>
        </table>
      </div>

    </div>
  </div>
  <script src="/static/plugs/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script src="/static/plugs/layui-v2.5.6/layui.all.js?v=1667474900" charset="utf-8"></script>
<link id="layuicss-layer" rel="stylesheet" href="/static/plugs/layui-v2.5.6/css/modules/layer/default/layer.css?v=3.1.1" media="all">

<script>
  $('.view_img').click(function(){
        var id = $(this).data("id");
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
            type: 2,
                    title: '查看',
                    area: ['60%', '80%'], //宽高*/
                    maxmin:true,
                    Boolean:1,
                    content: "/admin/usertree/payimg?orderid="+id,
            });
        });
    });

    $('.view_order').click(function(){
        var id = $(this).data("id");
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
            type: 2,
                    title: '查看',
                    area: ['60%', '80%'], //宽高*/
                    maxmin:true,
                    Boolean:1,
                    content: "/admin/user/fanorder?userid="+id,
            });
        });
    });
    
  </script>